Skip to content

Removing getCertificate() from the Credential interface#576

Merged
hiranya911 merged 4 commits intomasterfrom
hkj-credentials
Jun 27, 2019
Merged

Removing getCertificate() from the Credential interface#576
hiranya911 merged 4 commits intomasterfrom
hkj-credentials

Conversation

@hiranya911
Copy link
Contributor

Credential is a public interface and is declared as follows in the typings:

interface Credential {
    getAccessToken(): Promise<admin.GoogleOAuthAccessToken>;
}

But in the actual implementation (credential.ts), there's an additional method in the interface:

export interface Credential {
getAccessToken(): Promise<GoogleOAuthAccessToken>;
getCertificate(): Certificate;
}

This can cause issues if the developer implements the public Credential interface, and passes it through AppOptions. Internal code that expects to find a getCertificate() method will fail.

This PR addresses this issue by separating the getCertificate() method from the Credential interface.

Resolves #573

@samtstern
Copy link
Contributor

Some other places:

const cert: Certificate = app.options.credential.getCertificate();

const cert: Certificate = options.credential.getCertificate();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments